package d0320;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;

public class TimeTest {
    public static void main(String[] args) throws Exception {
       BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("src/d0320/calcCharNum.txt")));
        int[] count = new int[26];
        int[] COUNT = new int[26];

        char[] c = new char[1];
        int len = br.read(c);
        while (len != -1) {

            if (c[0] <= 'Z' && c[0] >= 'A') {
                int number = c[0];
                COUNT[number - 65]++;
            }
            if (c[0] <= 'z' && c[0] >= 'a') {
                int number = c[0];
                count[number - 97]++;
            }
            len = br.read(c);
        }
        Print(count, COUNT);
        System.out.print("\nb.txt");
        br.close();

    }

    public static void Print(int[] count, int[] COUNT) {
        for (int i = 0; i < 26; i++) {
            if (count[i] > 0) {
                char lowerCase = (char) (i + 97);
                System.out.println(lowerCase + "(" + count[i] + ")");
            }
            if (COUNT[i] > 0) {
                char upperCase = (char) (i + 65);
                System.out.println(upperCase + "(" + COUNT[i] + ")");
            }
        }


    }
}



